package com.yks.hbo.amazon.util;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.io.IOException;
import java.util.Properties;

/**
 * @Description: 属性文件读取类
 * @author: rbkevin.xu 
 * @version: 2018年11月28日 下午5:27:43
 */
public class PlsPropertiesUtil {
   private static final String path = "application.properties";
   public static final Resource resource = new ClassPathResource(path);
   public static Properties props = null;



   static {
       try {
           props = PropertiesLoaderUtils.loadProperties(resource);
       } catch (IOException e) {
           e.printStackTrace();
       }
   }

   /**
    * 获取指定key的value
    *
    * @param key
    * @return
    */
   public static String getProperty(String key) {
       return props.getProperty(key);
   }
}
